#pragma once

#include "Defines.hpp"
#include <string>

class TimeServerConfig
{
public:
	TimeServerConfig();
	~TimeServerConfig();

	bool loadFromString(nlohmann::json&workRoot);
	void clear();

	std::string getTaskUUID() const;
	int getTimeoutMs() const;
	float getSpeed() const;
	int getFps() const;
	int getNumBuiltinIds() const;
	int getTimeLoopTimeoutMs() const;
	std::string getRecordFile() const;
	std::string getReplayFile() const;
	struct SyncNode
	{
		std::string imageName;
		int imageInstanceId;
		bool bInNetwork = false;
	};
	std::vector<SyncNode> &getSyncNodes();
	void addNetWorkNode(Timer::NodeDescription node);
	std::vector<Timer::NodeDescription> &getNetWorkNodes();

public:
	enum {
		DefaultTimeoutMs = 0,
		DefaultFps = 60,
		DefaultTimeLoopTimeoutMs = 600000, // 10 min
	};

private:
	std::string mTaskUUID;
	int mTimeoutMs;
	float mSpeed;
	int mFps;
	int mNumBuiltinIds;
	int mTimeLoopTimeoutMs;
	std::string mRecordFile;
	std::string mReplayFile;
	std::vector<SyncNode> mSyncNodes;
	std::vector<Timer::NodeDescription> mNetWorkNodes;
};
